Sequence Diagram for the Movie Ticket Booking System
Visualize the sequence diagrams for the creation and payment of a booking, and practice the concepts with a challenge.
We'll cover the following
A sequence diagram is a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our movie ticket booking system. In this lesson, we will create sequence diagrams for the following three interactions:
Create a booking: The customer creates a booking for a show.
Payment for the booking: The customer pays for the booking.
Sequence challenge: The customer cancels their booking.
Create a booking#
The sequence diagram for creating a booking should have the following actors and objects that will interact with each other:
Actor:
Customer
Objects:
Catalog
,Movie
, andShowTime
System
Here’re the steps of the interaction to create a booking interaction:
The customer searches for a movie from the catalog.
The catalog returns the required movie.
They request show times for the movie they wanted to book.
The available show times for the movie are returned.
The customer requests available seats for the show.
If seats are available:
The customer receives a list of available seats.
The customer books their desired seats using the system.
The seat status is set to book.
The system requests payment against the booked seats from the customer.
Else if the seats are not available:
The customer is informed that no seats are available.
Based on the order above, the sequence diagram for creating a booking in the movie ticket booking system is given below.
Payment of a booking#
The sequence diagram for payment of a booking should have the following actors and objects that will interact with each other:
Actor:
Customer
Object:
Payment
,Seat
System
Here are the steps in the payment of a booking interaction:
The customer initiates a payment against the booking fee.
The payment processes the payment and informs the system.
If the payment is complete:
The payment informs the customer about the completed payment.
The system creates an object for the booking.
The booking status is updated and the system is informed.
The system sends a notification to the customer containing the booking information.
Else if the payment is declined:
The payment informs the customer about the declined payment.
The system requests to revert the seat status.
The seat status is updated to available and returned to the system.
The system informs the customer that the booking is declined.
Based on the order above, the sequence diagram for payment of a booking in the movie ticket booking system is given below.
Sequence challenge: Cancel booking#
You will complete a sequence diagram for a booking canceled by the customer. A skeleton of the cancel sequence diagram is given below:
Notice that the arrows in the diagram above are numbered from 1 to 7. The message boxes shown below are the messages to be exchanged between the actor(s) and object(s). Can you rearrange the messages below in the correct sequence of order they should appear in the skeleton of the sequence diagram given above?
Note: If you get stuck, just click the “Show Solution” button to check the correct answer.
Alternatively, you can also click the "Show complete diagram" button below to see the complete sequence diagram for the cancel booking interaction.
Next, let’s look at the activity diagrams for the movie ticket booking system to understand the control flow of the system.
Class Diagram for the Movie Ticket Booking System
Activity Diagram for the Movie Ticket Booking System